import type {
  ExtensibleFullAuditedEntityDto,
  IMultiTenant,
  IHasConcurrencyStamp,
  IHasEntityVersion,
  ExtensibleObject,
  PagedAndSortedResultRequestDto,
  EntityDto
} from '@/utils/api/type';

export interface LoginFormRequest extends IMultiTenant {
  userName: string;
  password: string;
}

export interface LoginFormResponse {
  accessToken: string;
  tokenType: string;
  refreshToken: string;
  expiresIn: number;
}

export interface IdentityUserDto
  extends ExtensibleFullAuditedEntityDto<string>,
    IMultiTenant,
    IHasConcurrencyStamp,
    IHasEntityVersion {
  userName: string;
  name: string;
  surname?: string;
  email: string;
  emailConfirmed: boolean;
  phoneNumber: string;
  phoneNumberConfirmed: boolean;
  isActive: boolean;
  lockoutEnabled: boolean;
  accessFailedCount: number;
  lockoutEnd?: Date;
  lastPasswordChangeTime?: Date;
}

export interface IdentityUserDetailDto extends IdentityUserDto {
  organizationId?: string;
  roleNames: string[];
}

export interface IdentityUserCreateOrUpdateDtoBase extends ExtensibleObject {
  userName: string;
  name?: string;
  surname?: string;
  email: string;
  phoneNumber: string;
  isActive: boolean;
  lockoutEnabled: boolean;
  roleNames: string[];
}

export interface IdentityUserCreateDto extends IdentityUserCreateOrUpdateDtoBase {
  password: string;
}

export interface UserCreateDto extends IdentityUserCreateDto {
  organizationId: string;
}

export interface IdentityUserUpdateDto extends IdentityUserCreateOrUpdateDtoBase {
  password?: string;
  concurrencyStamp: string;
}

export interface UserUpdateDto extends IdentityUserUpdateDto {
  organizationId: string;
}

export interface GetIdentityUsersInput extends PagedAndSortedResultRequestDto {
  filter: string;
}

export interface IdentityUserUpdateRolesDto {
  roleNames: string[];
}

export interface UserAvatarUpdateDto extends ExtensibleObject, IHasConcurrencyStamp {}

export interface SearchUserListInputDto {
  sorting?: string;
  filter?: string;
  maxResultCount?: number;
  userIds?: Array<string>;
}

export interface SearchUserOutputDto extends EntityDto<string> {
  userName: string;
  fullName: string;
}
